function evaluateExpressions(n, m, expressions, values) {
    // 将采集的数据存入一个对象
    const data = Object.fromEntries(values);

    const results = expressions.map(expression => {
        // 替换字段名为对应的值
        let modifiedExpression = expression;

        // 替换单引号，避免与原数据产生冲突
        for (const [key, value] of Object.entries(data)) {
            console.log(modifiedExpression)
            modifiedExpression = modifiedExpression.replace(new RegExp(`\\b${key}\\b`, 'g'), `'${value}'`);
            console.log(modifiedExpression)
        }

        // 计算表达式
        try {
            modifiedExpression = modifiedExpression.replace(/=/g, '===')
            console.log(modifiedExpression.replace(/AND/g, '&&').replace(/OR/g, '||'))
            const result = eval(modifiedExpression.replace(/AND/g, '&&').replace(/OR/g, '||'));
            return result ? 0 : 1; // 0 表示健康，1 表示不健康
        } catch (error) {
            console.error("Error evaluating expression:", error);
            return 1; // 默认不健康
        }
    });

    return results;
}

// 示例用法
const n = 2;
const m = 2;
const expressions = [
    "error = '0' AND (name = 'NE40' OR name = 'NE20')",
    "error = '1' AND (name = 'NE40' OR name = 'NE20')"
];
const values = [
    ["name", "NE40"],
    ["error", "0"]
];

// console.log(eval("'0' === '0'"))
console.log(evaluateExpressions(n, m, expressions, values)); // 输出: [0, 1]